package com.leyou.mall.data.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.Objects;

/**
 * @ClassName: Seckill
 * @author: LYL
 * @date: 2022/6/22 11:31
 * @Version 1.0
 */
@Data
@ToString
@TableName("mall_seckill")
public class Seckill {
    @ApiModelProperty("id")
    @TableId(value = "id",type = IdType.INPUT)
    private Integer id;

    @ApiModelProperty("活动编号")
    private String seckillNumber;

    @ApiModelProperty("活动名称")
    private String seckillName;

    @ApiModelProperty("商品数量")
    private Integer seckillCount;

    @ApiModelProperty("活动状态")
    private String seckillStatus;

    @ApiModelProperty("活动参加人数")
    private Integer peopleNum;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("活动开始时间")
    private Date startTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("活动结束时间")
    private Date stopTime;

    @ApiModelProperty("是否上架")
    private Boolean seckillType;

    @ApiModelProperty("删除标志")
    private Boolean deleteFlag;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建时间")
    private Date createDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("修改时间")
    private Date updateDate;


    @TableField(exist = false)
    private String activityDate;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Seckill seckill = (Seckill) o;
        return Objects.equals(id, seckill.id) && Objects.equals(seckillNumber, seckill.seckillNumber) && Objects.equals(seckillName, seckill.seckillName) && Objects.equals(seckillCount, seckill.seckillCount) && Objects.equals(seckillStatus, seckill.seckillStatus) && Objects.equals(peopleNum, seckill.peopleNum) && Objects.equals(startTime, seckill.startTime) && Objects.equals(stopTime, seckill.stopTime) && Objects.equals(seckillType, seckill.seckillType) && Objects.equals(deleteFlag, seckill.deleteFlag) && Objects.equals(createDate, seckill.createDate) && Objects.equals(updateDate, seckill.updateDate) && Objects.equals(activityDate, seckill.activityDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, seckillNumber, seckillName, seckillCount, seckillStatus, peopleNum, startTime, stopTime, seckillType, deleteFlag, createDate, updateDate, activityDate);
    }
}
